/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package sys.donto.telas;

/**
 *
 * @author JOABB
 */
public class telaRelatorioDesempenho extends javax.swing.JFrame {

    /**
     * Creates new form telaRelatorioDesempenho
     */
    public telaRelatorioDesempenho() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jlDentista = new javax.swing.JLabel();
        tfDentista = new javax.swing.JTextField();
        btPesquisarDentista1 = new javax.swing.JButton();
        jlData = new javax.swing.JLabel();
        tfDataConsulta = new javax.swing.JFormattedTextField();
        jLFundo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jlDentista.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jlDentista.setText("DENTISTA:");
        getContentPane().add(jlDentista, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 180, -1, -1));

        tfDentista.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        tfDentista.setEnabled(false);
        tfDentista.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDentistaActionPerformed(evt);
            }
        });
        getContentPane().add(tfDentista, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 180, 330, -1));

        btPesquisarDentista1.setBackground(new java.awt.Color(0, 153, 153));
        btPesquisarDentista1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sys/donto/imagens/Search 16.png"))); // NOI18N
        btPesquisarDentista1.setToolTipText(" Pesquisar Dentista");
        btPesquisarDentista1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btPesquisarDentista1ActionPerformed(evt);
            }
        });
        getContentPane().add(btPesquisarDentista1, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 180, 40, -1));

        jlData.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jlData.setText("DATA:");
        getContentPane().add(jlData, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 210, -1, -1));

        tfDataConsulta.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            tfDataConsulta.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tfDataConsulta.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tfDataConsultaFocusLost(evt);
            }
        });
        getContentPane().add(tfDataConsulta, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 210, 120, -1));

        jLFundo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sys/donto/imagens/telasPP.jpg"))); // NOI18N
        getContentPane().add(jLFundo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tfDentistaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDentistaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tfDentistaActionPerformed

    private void btPesquisarDentista1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btPesquisarDentista1ActionPerformed
        DentistaDAO dao = new DentistaDAO();// butão de pesquisa de estado.
        List<Dentista> lista = dao.listar();
        DentistaTableModel dtm = new DentistaTableModel(lista);
        Object o = telaPesquisa.exibeTela(dtm, "dentista");
        Dentista d;
        if (o != null) {
            d = dao.pesquisaId(Integer.valueOf(String.valueOf(o)));
            consulta.setDentista(d);
            tfDentista.setText(d.getNome());      // TODO add your handling code here:
    }//GEN-LAST:event_btPesquisarDentista1ActionPerformed

    private void tfDataConsultaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfDataConsultaFocusLost
        if(Util.dataValida(tfDataConsulta.getText().toString())== false){
            JOptionPane.showMessageDialog(rootPane, "Data Inválida, redigite!", "ERRO", JOptionPane.ERROR_MESSAGE);
            tfDataConsulta.setText("");
        }

    }//GEN-LAST:event_tfDataConsultaFocusLost

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(telaRelatorioDesempenho.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(telaRelatorioDesempenho.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(telaRelatorioDesempenho.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(telaRelatorioDesempenho.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new telaRelatorioDesempenho().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btPesquisarDentista1;
    private javax.swing.JLabel jLFundo;
    private javax.swing.JLabel jlData;
    private javax.swing.JLabel jlDentista;
    private javax.swing.JFormattedTextField tfDataConsulta;
    private javax.swing.JTextField tfDentista;
    // End of variables declaration//GEN-END:variables
}
